<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
<!--    MD5工具类-->
    <script src="https://cdn.bootcdn.net/ajax/libs/blueimp-md5/2.18.0/js/md5.js"></script>

</head>
<body>
<!--表单绑定提交事件-->
<!--onsubmit = 绑定一个提交的函数：true，false-->
<!--将这个结果返回给表单，onsubmit接收-->
<form action="#" method="post" onsubmit="return aaa()">
    <p>
        <span>用户名：</span><input type="text" id="usernaem1" name="usernaem2">
    </p>
    <p>
        <span>密码：</span><input type="password" id="pwd1" >

    </p>
    <input type="hidden" id="md5-password" name="password">
<!--按钮绑定    <button type="submit" onclick="aaa()">提交</button>-->
<button type="submit">提交</button>
</form>
<script>
    function aaa() {
        var uname = document.getElementById("usernaem1");
        var pwd = document.getElementById("pwd1");
        var md5pwd = document.getElementById("md5-password");

        md5pwd.value = md5(pwd.value);
        // // MD5算法
        // pwd.value = md5(pwd.value);

        //可以校验判断表单内容，true就是通过,false阻止
        return true;
    }
</script>

</body>
</html>